from django.contrib import admin
from .models import Approval, ApprovalRecord


@admin.register(Approval)
class ApprovalAdmin(admin.ModelAdmin):
    list_display = ['title', 'applicant', 'approval_type', 'status', 'current_level', 'created_at']
    list_filter = ['approval_type', 'status', 'created_at']
    search_fields = ['title', 'content', 'applicant__username']


@admin.register(ApprovalRecord)
class ApprovalRecordAdmin(admin.ModelAdmin):
    list_display = ['approval', 'approver', 'level', 'action', 'created_at']
    list_filter = ['action', 'level', 'created_at']
    search_fields = ['approver__username', 'comment']
